const Koa = require("koa");
const router = require("koa-router")();
const static = require("koa-static");
const app = new Koa();
app.use(static(__dirname + "/public"));
router.get("/", async ctx => {
    ctx.body = "<h1>欢迎来到首页</h1>"
})
router.get("/doc", async ctx => {
    ctx.body = `
    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Document</title>
        <link rel="stylesheet" href="/css/server.css">
    </head>
    <body>
        <p>文章内容</p>
        <img src='/img/a.jpg'>
    </body>
    </html>
    `
})

app.use(router.routes())

app.listen(3000, () => {
    console.log("启动成功")
})